package com.neusoft.elmboot.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.neusoft.elmboot.po.Food;

@Mapper
public interface FoodMapper {
	@Select("select * from food where businessId=#{businessId} order by foodId")
	public List<Food> listFoodByBusinessId(Integer businessId);

	@Select("select * from food where foodId=#{foodId}")
	public Food getFoodById(Integer foodId);
	
	@Delete("delete from food where foodId=#{foodId}")
	public int delFoodById(Integer foodId);
	
	@Insert("insert into food values(#{foodId},#{foodName},#{foodExplain},0,#{foodPrice},#{businessId},null)")
	public int addFoodByBusinessId(Food food);
	
	@Update("update food set foodName=#{foodName}, foodExplain=#{foodExplain}, foodPrice=#{foodPrice} where foodId=#{foodId}" )
	public int changeFood(Food food);
	
	@Select("select * from food where foodId=#{foodId}")
	public Food GetFoodById(Integer foodId);
	
}